/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.campaign.biz;

import com.aptech.campaign.dao.ReportDAO;
import com.aptech.campaign.entities.Campaign;
import com.aptech.campaign.entities.Report;
import java.sql.Date;
import java.util.ArrayList;

/**
 *
 * @author Tai Nguyen
 */
public class ReportBiz {

    ReportDAO dao = new ReportDAO();

    public ReportBiz() {
    }

    /**
     * get Arraylist Campaign have finished
     * @param
     * @return ArrayList<Campaign> arr
     */
    public ArrayList<Campaign> findByAllcampaign() {
        return dao.readByAllcampaign();
    }

    /**
     * get SaleTarget of a campaign
     * @param int campaignID
     * @return the float value
     */
    public float findBySaleTarget(int campaignID) {
        return dao.readBySaleTarget(campaignID);
    }

    /**
     * get ActualSale of a campaign
     * @param int campaignID
     * @return the float value
     */
    public float findByActualSale(int campaignID) {
        return dao.readByActualSale(campaignID);
    }

    /**
     * get BudgetAllocation of a campaign
     * @param int campaignID
     * @return the float value
     */
    public float findByBudgetAllocation(int campaignID) {
        return dao.readByBudgetAllocation(campaignID);
    }

    /**
     * get ActualBudget of a campaign
     * @param int campaignID
     * @return the float value
     */
    public float findByActualBudget(int campaignID) {
        return dao.readByActualBudget(campaignID);
    }

    /**
     * get all data of campaigns in a give time frame
     * @param Date firstDate, Date secondDate
     * @reutrn ArrayList<Report> arr
     */
    public ArrayList<Report> findByDate(Date firstDate, Date secondDate) {
        return dao.readByDate(firstDate, secondDate);
    }

    /**
     * @return the lasterror
     */
    public String getLasterror() {
        return dao.getLasterror();
    }

    /**
     * @param lasterror the lasterror to set
     */
    public void setLasterror(String lasterror) {
        dao.setLasterror(lasterror);
    }
}
